# from civen_license import HardwareInfoCollector, MachineCodeGenerator, LicenseVerifier
#
# # 1. 创建硬件信息收集器
# hardware_collector = HardwareInfoCollector()
# print("硬件信息收集器已创建",hardware_collector)
# # 2. 生成机器码
# machine_code_generator = MachineCodeGenerator("rag-core", hardware_collector)
# machine_code = machine_code_generator.generate_machine_code()
# print(f"机器码: {machine_code}")
#
# # # 3. 验证授权
# license_verifier = LicenseVerifier(machine_code_generator)
# # # 使用授权码和私钥验证
# private_key = '''-----BEGIN PRIVATE KEY-----
# MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCvfSY7//sslQJl
# 0PO3Apj+/xgV4zOM+4NFSh8PHizjy6a+0MaK9Vz1BIVForXQDZBN0ZgJPCBHZiNI
# TImxTDHDlHyHX5WdRMPvtM/uiSy8VzWUfeLfEsgeqMnLGH63MvJ+A6kNpzlfBaW0
# S1ZAq80LnPkmI/qHKyzi10e6AEq76J0z9G/0YT1dv5oLV/kxc1ItZpZevW+5N6Pa
# 7ruVfZcT5p8KUHaUmQtRBKGkxDUV0jVGq3kxf0TM4jZ2v5UIULVQWHlglBApr9qS
# e+N9zX880EU5Ver3W+PwkxnMpA+UuBtbwcMLX7H0ePlfdWJ6svF4l59bMEI2Y9vC
# QisnJqhHAgMBAAECggEAUVePpOkS2kfZfCs+BHraQvwoBGEzUGp2nuPsAJxqj04i
# 5LiuBtQTeejWA4CXiK/4zvFTaRhrF91Chm0ft8RLHs5RaIhIN8Ubkxz68qS3zTcZ
# OVKemerBQuDW5GJevfkKCJoWvqLgB2j9NVRkTwazPOpOXDz6D7RWEnFaKF+hRHaY
# P9YW3Be37HWMCWq/YF2rL1JKB/UoPWZIk133vFztnmArXPVW3B8C2tUHLTcx628S
# b33xwkfSZfCRUv1hmH8/jrKtcOosvsFRJd350O8eNiG9KS1s+Iib8GdQUwZdWe0v
# OBlZQafq0NYPE0DEGnQzjvbtWWWxma872TUtxypcUQKBgQDyY5Nn0nWSWPzCW9Hf
# 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xn6atzf7L0V6xToTNklO8PTXqnxGngDZwsduqBpbF6qlH/wP4fisuNr/bDvaaZiIKK+W6OIvMk8XRJtke+a+w4BZHGwiaLEjLhxWxcBKUopvn89uTi/zecaauSGzwPmCvd797uAfl8gicdOXFKo+9k2CLCQQaPLhHO2yUcbtynpdWsA3eisnQ=='''
# is_licensed = license_verifier.validate_license_with_key(license_code, private_key)
# print(f"授权状态: {'已授权' if is_licensed else '未授权'}")